﻿using System.Text.RegularExpressions;
using AutoMapper;

namespace net.xBei.Models.Mapping; 
#pragma warning disable CS1591 // 缺少对公共可见类型或成员的 XML 注释
public class UpperUnderscoreNamingConvention : INamingConvention {
    public Regex SplittingExpression { get; } = new Regex(@"[\p{Ll}\p{Lu}0-9]+(?=_?)");

    /// <inheritdoc/>
    public string SeparatorCharacter => "_";

    public string ReplaceValue(Match match) => match.Value.ToUpper();

    /// <inheritdoc/>
    public string[] Split(string input) {
        return (input).Split(SeparatorCharacter);
    }
}
